package hibernate.billStream;

import java.util.*;
import hibernate.p.*;

public class ServiceWrapper {
	
	private Service inner;
	private Set catagoriesIncluded;
	private Long id;
	
	public Service getInner(){
		return inner;
	}
	
	public void setCatagoriesIncluded(Set set){this.catagoriesIncluded=set;}
	
	public Set getCatagoriesIncluded(){return this.catagoriesIncluded;}
	
	public String getConcrete(){return inner.toString();}
	
	public void setConcrete(String ser){
		this.inner=Service.getService(ser);
		if(inner == null){
			StringTokenizer str=new StringTokenizer(ser,"|");
			Service.createNew(str.nextToken(),
							  str.nextToken(),
							  new Boolean(str.nextToken()),
							  new Pair(new Double(str.nextToken()),
									   Unit.parseUnit(str.nextToken())));
			inner=Service.getService(ser);
		}
	}
	
	public Long getId(){return id;}
	
	public void setId(Long id){this.id=id;}
	
	public Service getService(){return inner;}
	
	public boolean equals(Object obj){
		if(!(obj instanceof ServiceWrapper))
			return false;
		else return this.id.equals(((ServiceWrapper)obj).id);
	}
	
	public Service getConcreteWrapper(){
		return inner;
	}
}
